//
//  MessageViewController.m
//  dangdang
//
//  Created by air on 16/3/5.
//  Copyright © 2016年 luweijie. All rights reserved.
//

#import "MessageViewController.h"
#import "MessageSecondTableViewCell.h"

@interface MessageViewController ()

@end

@implementation MessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _messageTableView.rowHeight = UITableViewAutomaticDimension;
    _messageTableView.estimatedRowHeight = 44.0;
    _messageTableView.separatorStyle = UITableViewCellSelectionStyleNone;
    
    self.title = @"我的消息";
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"清空" style:UIBarButtonItemStylePlain target:self action:@selector(emptyArray)];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)emptyArray{
    
}

#pragma mark UITableViewDataSource && Delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;
    
    MessageSecondTableViewCell * secondCell = [tableView dequeueReusableCellWithIdentifier:@"messageSecondTableViewCell" forIndexPath:indexPath];
        
//        NSRange strRange = {13,15};
//        
//        NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:_message2];
//        //    设置：内容显示成颜色
//        [str addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:48/255.0 green:153/255.0 blue:247/255.0 alpha:1.0] range:strRange];
//        //    设置：加下划线
//        [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];
//        
//        secondCell.messageLabel.attributedText = str;
//        
//        secondCell.confirmButton.layer.cornerRadius = 4;
    secondCell.messageLabel.text = _message;
    secondCell.timeLabel.text = _message2;
    secondCell.timeLabel.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.8];
    secondCell.timeLabel.layer.cornerRadius = 10;
    secondCell.timeLabel.layer.masksToBounds = YES;
    cell = secondCell;
    
    cell.backgroundColor = _messageTableView.backgroundColor;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.1f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.1f;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
